package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.CommentDetailsDto;
import com.heima.model.wemedia.dtos.WmCommentListDto;
import com.heima.model.wemedia.dtos.WmCommentReplyDto;
import com.heima.model.wemedia.dtos.WmCommentStatusDto;
import com.heima.wemedia.service.WmCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/comment/manage")
public class WmCommentController {
    @Autowired
    private WmCommentService wmCommentService;

    /**
     * 回复评论
     * @param dto
     * @return
     */
    @PostMapping("/comment_repay")
    public ResponseResult commentRepay(@RequestBody WmCommentReplyDto dto){
        return wmCommentService.commentRepay(dto);
    }

    /**
     * 查看评论列表
     * @param dto
     * @return
     */
    @PostMapping("/find_news_comments")
    public ResponseResult findNewsComments(@RequestBody WmCommentListDto dto){
        return wmCommentService.findNewsComments(dto);
    }

    /**
     * 打开或关闭评论
     * @param dto
     * @return
     */
    @PostMapping("/update_comment_status")
    public ResponseResult updateCommentStatus(@RequestBody WmCommentStatusDto dto){
        return wmCommentService.updateCommentStatus(dto);
    }

    /**
     * 查看文章评论的详细内容
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public ResponseResult ViewCommentDetails(@RequestBody CommentDetailsDto dto){
        return wmCommentService.ViewCommentDetails(dto);
    }
}
